#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cstring>

using namespace std;

int main(){
	ifstream inFile;		// object for handling file input
	inFile.open("a.txt");

	if (!inFile.is_open()) // failed to open file
	{
		cout << "Could not open the file " << " a.txt " << endl;
		cout << "Program terminating.\n";
		exit(EXIT_FAILURE);
	}
	
	string content;
	char value;
	inFile >> value;
	
	while(inFile.good()){
		content += value;
		inFile >> value;
	}
	
	if (inFile.eof())
		cout <<  content << endl;	// "End of file reached";
	else if (inFile.fail())
		cout << "Input terminated by data mismatch.\n";
	else
		cout << "Input terminated for unknown reason.\n";

	inFile.close();

	return 0;
}
